<!DOCTYPE html>

<html xmlns:th="http://www.thymeleaf.org"
	xmlns:sec="http://www.thymeleaf.org">
<head>

</head>

<body>

	<table id="userTable" th:fragment="usertable"
		class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th colspan="6"><span class="label label-info">Users</span> 
					<!-- 
					<a class="btn btn-primary pull-right btn-small" href="newuser">New
						User</a>
					 -->	
					<a th:if="${nav=='project'  and projectuser == null}"
						class="btn btn-primary pull-right btn-small" th:href="@{/newprojectuser(project=${project.id})}" th:text="#{adduser}">
					</a>	
						
					
					 	
				</th>
			</tr>
			<tr>
				<th style="with: 5%" th:utext="#{sl}"></th>
				<th th:utext="#{name}"></th>
				<th th:utext="#{email}"></th>
				<th th:utext="#{company}"></th>
				<th th:utext="#{created}"></th>
				<th th:utext="#{role}"></th>
				
				<th th:utext="#{actions}" th:if="${nav == 'project'}"></th>
				
			</tr>
		</thead>
		<tbody>
			<tr th:each="u , row : ${users}"
				th:with="c=${u.createdDate.toDate()}">
				<td style="with: 5%">
					<!-- 
								th:href="@{/edituser(user=${u.id})}"
							 --> <a href="#" th:text="${row.count}">1</a>
				</td>
				<td><a href="#" th:text="${u.name}">1</a></td>
				<td><a href="#" th:text="${u.email}">1</a></td>
				<td><a href="#" th:text="${u.company.name}">1</a></td>
				<td><a href="#" th:text="${beans.pretty.format(c)}">1</a></td>
				<td><a href="#" th:text="${u.role.name}">1</a></td>
				
				<td th:if="${nav == 'project'}">
					<a class="btn btn-primary pull-right btn-small" th:href="@{/updatemanager(user=${u.id}, project=${project.id})}"
						th:utext="#{setasmanager}" th:if="${nav == 'project' and projectuser == null}"></a>
					
					<a class="btn btn-primary pull-right btn-small" th:href="@{/saveprojectuser(user=${u.id}, project=${project.id})}"
						th:utext="#{addtoproject}" th:if="${projectuser == true}"></a>	
				</td>
				
			</tr>
		</tbody>
	</table>

</body>
</html>
